﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="QueryUtilityFactory.cs" company="CodePlex">
//   Copyright © CodePlex 2012
// </copyright>
// <summary>
//   Defines the QueryUtilityFactory type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace DataFramework.Factories
{
    using System;

    using DataFramework.QueryUtilities;

    /// <summary>
    /// Factory to provide the caller with the correct helper based on the configuration.
    /// </summary>
    public class QueryUtilityFactory
    {
        /// <summary>
        /// Fetches the helper based off the configuration.
        /// </summary>
        /// <returns>A helper for the configured database.</returns>
        internal static BaseQueryUtility FetchConfiguredHelper()
        {
            var databaseType = DatabaseConfiguration.DbType;
            switch (databaseType)
            {
                case DatabaseType.OleDb: 
                    return OleDbQueryUtility.Instance;
                case DatabaseType.MySql:
                    return BaseQueryUtility.Instance;
                default: throw new NotImplementedException();
            }
        }
    }
}
